package com.wntime.simulator.utils;

import java.util.Date;

public class TimeUtils {
    public static Boolean compareTime(String start, String end) {
        Date now = new Date();
        int currentHour = now.getHours();
        int currentMinute = now.getMinutes();

        String s = currentHour + "" + currentMinute;
        int curr = Integer.parseInt(s);
        int sti = Integer.parseInt(start.replace(":", ""));
        int eni = Integer.parseInt(end.replace(":", ""));
        if (sti > eni) {
            int c = 2400;
            return (curr > sti && curr < c) || (curr < eni);
        } else if (sti < eni) {
            return sti < curr && curr < eni;
        } else {
            return true;
        }


//        String[] startParse = start.split(":");
//        int startHour = Integer.parseInt(startParse[0]);
//        int startMinute = Integer.parseInt(startParse[1]);
//
//        String[] endParse = end.split(":");
//        int endHour = Integer.parseInt(endParse[0]);
//        int endMinute = Integer.parseInt(endParse[1]);

        // 判断是否在时间段内
//        if (currentHour >= startHour && currentHour < endHour) {
//            return currentMinute >= startMinute && currentMinute < endMinute;
//        } else {
//            return false;
//        }
    }
}
